package com.chinasofti.filestream;

import java.io.FileOutputStream;
import java.io.IOException;

public class Demo02 {

    public static void main(String[] args) throws IOException {

        FileOutputStream fos = new FileOutputStream("java418\\fox.txt");
//        fos.write(100);
//        fos.write(101);
//        fos.write(102);
//        fos.write(103);

        //2. write(byte[] b)
        //byte[] bys ={97,98,99,100};
        byte[] bys = "hanmeimei".getBytes();

        //3.write(byte[] b, int off, int len)
        //fos.write(bys,1,3);//将len字节从指定的字节数组开始 ，从偏移量off开始写入次输出流
        fos.write(bys,0,bys.length);
        //fos.write(bys);

        //最后释放资源
        fos.close();
    }
}
